package 依赖倒置原则;

import java.util.List;

/**
 * @ClassNameMain
 * @Description
 * @Author
 * @Date2021/11/13 16:22
 **/
public class Main {
    public static void main(String[] args) {
        /*Custom custom = new Custom();
        // 买兰州特产
        custom.buy(new LanZhouShop());
        // 买成都特产
        custom.buy(new ChengduShop());*/

        /**
         * 依赖注入
         */
        /*Student student = new Student();
        student.study(new JavaCourse());
        student.study(new CplusCourse());*/
        /**
         * 构造注入
         */
        System.out.println("构造方式注入:");
        Student student = new Student(new JavaCourse());
        student.study();
        /**
         * set注入
         */
        System.out.println();
        System.out.println("set方式注入:");
        student.setCourse(new CplusCourse());
        student.study();
    }
}
